package com.igroupes.ovineherd.model.utils;

import com.alibaba.fastjson.JSONArray;

import java.util.ArrayList;
import java.util.List;

public class ListUtils {
    public static String toJsonString(List list) {
        return null != list && 0 != list.size() ? com.alibaba.fastjson.JSONObject.toJSONString(list) : null;
    }
    public static List<Object> parse(String json) {
        return json != null && json.length() != 0 ? com.alibaba.fastjson.JSONObject.parseArray(json, Object.class) : null;
    }

    public static String toListString(List<String> list) {
        return null != list && 0 != list.size() ? com.alibaba.fastjson.JSONObject.toJSONString(list) : null;
    }
    public static List parseString(String str) {

        if (null == str || str.length() == 0) {
            return new ArrayList();
        }
        return JSONArray.parseArray(str);
    }
}
